﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ICement_Buying.Code;
using OA.Model;
using OA.Business;
using MyCement.Database;
using System.Collections;
namespace ICement_Buying.Admin
{
    public partial class ProductList : AuthPageBase
    {
        public IProductBusiness ProBll { get; set; }
        protected IList<Product> _products = new List<Product>();
        Hashtable table = new Hashtable();
        protected override void OnLoad(EventArgs e)
        {
            MyCement.Database.PageStructure ps = new MyCement.Database.PageStructure { PageSize = 15, CurrPage = 1 };
            if (!string.IsNullOrEmpty(QueryParam("page")))
            {
                ps.CurrPage = Convert.ToInt32(QueryParam("page"));
            }
            table.Clear();
            table.Add("CurrPage",ps.CurrPage);
            table.Add("PageSize", ps.PageSize);
            
            //_products = ProBll.GetAllRecord();
            _products = ProBll.GetRecordsforPage(table, ps);
            pager.PageStruct = new MyCement.Database.PageStructure { Counts = ps.Counts, CurrPage = ps.CurrPage, PageCount = ps.PageCount, PageSize = ps.PageSize };
        }
    }
}